package com.woniuxy.finance.service.impl;


import com.woniuxy.commons.utils.ResStatus;
import com.woniuxy.commons.utils.ResponseResult;
import com.woniuxy.finance.dao.DealDao;
import com.woniuxy.finance.entity.Deal;
import com.woniuxy.finance.entity.Refund;
import com.woniuxy.finance.service.DealService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @ClassName DealServiceImpl
 * @Description TODO
 * @Author WXY
 * @Date 2022/6/10 14:30
 * @Version 1.0
 */
@Service
public class DealServiceImpl implements DealService {

    @Resource
    private DealDao dealDao;



    @Override
    public ResponseResult<List<Deal>> findAll() {
        List<Deal> all = dealDao.findAll();
        return new ResponseResult<>(200,"查询成功",all, ResStatus.SUCCESS);
    }



    @Override
    public ResponseResult<List<Deal>> findAllByWeek() {
        List<Deal> all = dealDao.findAllByWeek();
        return new ResponseResult<>(200,"查询成功",all,ResStatus.SUCCESS);
    }

    @Override
    public ResponseResult<List<Deal>> findAllByMonth() {

        List<Deal> all = dealDao.findAllByMonth();
        return new ResponseResult<>(200,"查询成功",all,ResStatus.SUCCESS);
    }

    @Override
    public ResponseResult<List<Deal>> findAllByDate(String date) {
        List<Deal> all = dealDao.findAllByDate(date);
        return new ResponseResult<>(200,"查询成功",all,ResStatus.SUCCESS);
    }

    @Override
    public ResponseResult<List<Refund>> findRefundAll() {
        List<Refund> refundList = dealDao.findRefundAll();
        return new ResponseResult<>(200,"查询成功",refundList,ResStatus.SUCCESS);
    }

    @Override
    public BigDecimal sumDeal() {
        BigDecimal sum = dealDao.sumDeal();
        return sum;
    }

    @Override
    public int numDeal() {
        int num = dealDao.numDeal();
        return num;
    }

    @Override
    public BigDecimal effectSum() {
        BigDecimal effect = dealDao.effectDeal();
        return effect;
    }
}
